package com.cloud.easy.im.utils;

import io.netty.buffer.ByteBuf;
import io.netty.util.CharsetUtil;

/**
 * ByteBuf 与 Jons转换工具
 * @author wangjian
 * @version 0.1.0
 * @create 2020年09月03日6:35 下午
 */
public class ByteBufJsonConvert {

    /**
     * buffer To String
     * @param buffer
     * @return
     */
    public static String bufToString(ByteBuf buffer)
    {
        byte[] req = new byte[buffer.readableBytes()];
        buffer.readBytes(req);
        return new String(req, CharsetUtil.UTF_8);
    }

}
